#include "CSerialPort.h"
#include "Tracker.h"
#include <opencv2/videoio.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>
#include <iomanip>
#include <termios.h>
#include <netinet/in.h>
#include<sys/ioctl.h>
#include <thread>
using namespace std;
using namespace cv;

const int IMG_WIDTH = 2688, IMG_HEIGHT = 1520;

vector<Point2f> center;
CSerialPort myserialport; //打开串口
char send_data[8];

int main(int argc, char **argv)
{
	
	VideoCapture video_in( "/home/ubuntu/桌面/golfbos/source/5919.avi");
	string video_name="123";	
	time_t rawtime;
	struct tm *ptm;	
	time(&rawtime);
    ptm = gmtime(&rawtime);
	string title;
	Mat frame;
	namedWindow(video_name);

// 	cout << "\nPress any key to stop the video and select a bounding box" << endl;
	// cv::Rect uBox;
 	// uBox=Rect(213,57,304,303);
	while (waitKey(20) < 1)
	{
		video_in >> frame;
		imshow(video_name, frame);
		
	time(&rawtime);
    ptm = gmtime(&rawtime);
	title=to_string(ptm->tm_yday)+"-"+to_string(ptm->tm_hour)+"-"+to_string(ptm->tm_min)+"-"+to_string(ptm->tm_sec);

    title = "/home/ubuntu/桌面/golfbos/source/" + title + ".jpg";
	imwrite(title,frame);
		//	cout<<iFrameHeight<<"   "<<iFrameWidth<<endl;

	}
	//vector<Point2f> bb;

	return 0;
}
